<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Source: vertx/tcp_support.js</title>
    
    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">
    
    <h1 class="page-title">Source: vertx/tcp_support.js</h1>
    
    


    
    <section>
        <article>
            <pre class="prettyprint source"><code>tcpSupport = function(server, jserver) {
  /**
   * Provides TCP support functions to network objects. Do not use this object directly.
   * @see module:vertx.net
   * @see module:vertx.http
   * @mixin
   */
  TCPSupport = {
    /**
     * Set or get the TCP no delay value.
     * @param {boolean} [nodelay] If provided, set the value; if not, returns the current value.
     * @return {boolean|{{}}} the value or this
     */
    tcpNoDelay: function(nodelay) {
      if (nodelay === undefined) {
        return jserver.isTCPNoDelay();
      } else {
        jserver.setTCPNoDelay(nodelay);
        return server;
      }
    },

    /**
     * Set or get the send buffer size
     * @param {number} [size] If provided, set the value; if not, returns the current value.
     * @return {number|{{}}} the value or this
     */
    sendBufferSize: function(size) {
      if (size === undefined) {
        return jserver.getSendBufferSize();
      } else {
        jserver.setSendBufferSize(size);
        return server;
      }
    },

    /**
     * Set or get the receive buffer size
     * @param {number} [size] If provided, set the value; if not, returns the current value.
     * @return {number|{{}}} the value or this
     */
    receiveBufferSize: function(size) {
      if (size === undefined) {
        return jserver.getReceiveBufferSize();
      } else {
        jserver.setReceiveBufferSize(size);
        return server;
      }
    },

    /**
     * Set or get the TCP keep-alive value
     * @param {boolean} [keepAlive] If provided, set the value; if not, returns the current value.
     * @return {boolean|{{}}} the value or this
     */
    tcpKeepAlive: function(keepAlive) {
      if (keepAlive === undefined) {
        return jserver.isTCPKeepAlive();
      } else {
        jserver.setTCPKeepAlive(keepAlive);
        return server;
      }
    },

    /**
     * Set or get the TCP reuse address value
     * @param {boolean} [reuse] If provided, set the value; if not, returns the current value.
     * @return {boolean|{{}}} the value or this
     */
    reuseAddress: function(reuse) {
      if (reuse === undefined) {
        return jserver.isReuseAddress();
      } else {
        jserver.setReuseAddress(reuse);
        return server;
      }
    },

    /**
     * Set or get the TCP so linger value
     * @param {boolean} [linger] If provided, set the value; if not, returns the current value.
     * @return {boolean|{{}}} the value or this
     */
    soLinger: function(linger) {
      if (linger === undefined) {
        return jserver.isSoLinger();
      } else {
        jserver.setSoLinger(linger);
        return server;
      }
    },
    
    /**
     * Set or get the TCP traffic class
     * @param {number} [class] If provided, set the value; if not, returns the current value.
     * @return {number|{{}}} the value or this
     */
    trafficClass: function(cls) {
      if (cls === undefined) {
        return jserver.getTrafficClass();
      } else {
        jserver.setTrafficClass(cls);
        return server;
      }
    },

    /**
     * Set or get if vertx should use pooled buffers for performance reasons.
     * Doing so will give the best throughput but may need a bit higher memory
     * footprint.
     * @param {boolean} [use] If provided, set the value; if not, returns the current value.
     * @return {boolean|{{}}} the value or this
     */
    usePooledBuffers: function(use) {
      if (use === undefined) {
        return jserver.isUsedPooledBuffers();
      } else {
        jserver.setUsePooledBuffers(use);
        return server;
      }
    }
  }
  server.tcpNoDelay           = TCPSupport.tcpNoDelay;
  server.sendBufferSize       = TCPSupport.sendBufferSize;
  server.receiveBufferSize    = TCPSupport.receiveBufferSize;
  server.tcpKeepAlive         = TCPSupport.tcpKeepAlive;
  server.reuseAddress         = TCPSupport.reuseAddress;
  server.soLinger             = TCPSupport.soLinger;
  server.trafficClass         = TCPSupport.trafficClass;
  server.usePooledBuffers     = TCPSupport.usePooledBuffers;
}

serverTcpSupport = function(server, jserver) {
  /**
   * Provides server-side-only TCP support functions. Do not use this object directly.
   * @mixin 
   * @see module:vertx/net
   * @see module:vertx/http
   */
  ServerTCPSupport = {

    /**
     * Set or get the server's accept backlog
     * @param {number} [backlog] If provided, set the value; if not, returns the current value.
     * @return {number|{{}}} the value or this
     */
    acceptBacklog: function(backlog) {
      if (backlog === undefined) {
        return jserver.getAcceptBacklog();
      } else {
        jserver.setAcceptBacklog(backlog);
        return server;
      }
    }
  }
  server.acceptBacklog = ServerTCPSupport.acceptBacklog;
}
</code></pre>
        </article>
    </section>




</div>

<nav>
    <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-vertx.html">vertx</a></li><li><a href="buffer.html">vertx/buffer</a></li><li><a href="console.html">vertx/console</a></li><li><a href="container.html">vertx/container</a></li><li><a href="event_bus.html">vertx/event_bus</a></li><li><a href="file_system.html">vertx/file_system</a></li><li><a href="http.html">vertx/http</a></li><li><a href="multi_map.html">vertx/multi_map</a></li><li><a href="net.html">vertx/net</a></li><li><a href="parse_tools.html">vertx/parse_tools</a></li><li><a href="pump.html">vertx/pump</a></li><li><a href="shared_data.html">vertx/shared_data</a></li><li><a href="sockjs.html">vertx/sockjs</a></li><li><a href="timer.html">vertx/timer</a></li></ul><h3>Externals</h3><ul><li><a href="InetSocketAddress.html">InetSocketAddress</a></li><li><a href="Buffer_.html">Buffer</a></li><li><a href="RecordParser.html">RecordParser</a></li><li><a href="SockJSSocket.html">SockJSSocket</a></li></ul><h3>Classes</h3><ul><li><a href="buffer-Buffer.html">Buffer</a></li><li><a href="file_system.AsyncFile.html">AsyncFile</a></li><li><a href="http.HttpClient.html">HttpClient</a></li><li><a href="http.HttpClientRequest.html">HttpClientRequest</a></li><li><a href="http.HttpClientResponse.html">HttpClientResponse</a></li><li><a href="http.HttpServer.html">HttpServer</a></li><li><a href="http.HttpServerFileUpload.html">HttpServerFileUpload</a></li><li><a href="http.HttpServerRequest.html">HttpServerRequest</a></li><li><a href="http.HttpServerResponse.html">HttpServerResponse</a></li><li><a href="http.RouteMatcher.html">RouteMatcher</a></li><li><a href="http.WebSocket.html">WebSocket</a></li><li><a href="multi_map-MultiMap.html">MultiMap</a></li><li><a href="net.NetClient.html">NetClient</a></li><li><a href="net.NetServer.html">NetServer</a></li><li><a href="net.NetSocket.html">NetSocket</a></li><li><a href="pump-Pump.html">Pump</a></li><li><a href="sockjs.SockJSServer.html">SockJSServer</a></li></ul><h3>Mixins</h3><ul><li><a href="ClientSSLSupport.html">ClientSSLSupport</a></li><li><a href="ReadStream.html">ReadStream</a></li><li><a href="ServerSSLSupport.html">ServerSSLSupport</a></li><li><a href="ServerTCPSupport.html">ServerTCPSupport</a></li><li><a href="SSLSupport.html">SSLSupport</a></li><li><a href="TCPSupport.html">TCPSupport</a></li><li><a href="WriteStream.html">WriteStream</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>

<br clear="both">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a> on Wed Jul 17 2013 20:27:22 GMT+0100 (BST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>